#ifndef _HOME_SERVER_STATUS_
#define _HOME_SERVER_STATUS_

#include <time.h>
#include <string>

class CServerStatus
{
public:
	enum eStatus
	{
		Null_Status = 0,
		//Main Status
		Main_Off,							// HomeServer is turn off.
		Main_Connecting,					// HomeServer is connect to internet.
		Main_Ready,							// HomeServer is online for using.

		// Login Status
		Account_Offline,					// Not login 
		Account_Logging,					// logging
		Account_Online,						// login finished

		// General Status
		Avail,	
		Detecting,
		Unavail, 

		// Announce status
		Announce_OK,						// Successfully announce IP to network
		Announce_Going,						// announcing.
		Announce_Fail						// Can not announce.
	};

	// Main Status
	eStatus			m_MainStatus;
	
	// Login Status
	eStatus			m_LoginStatus;
	time_t			m_LoginTime;

	// IP Detecting Status
	eStatus			m_IPStatus;
	std::string		m_LocalIP;
	std::string		m_PublicIP;
	time_t			m_DetectTime;

	// NAT Traversal Status
	eStatus			m_NATTStatus;
	bool			m_HasNAT;
	
	// Announce Status
	eStatus			m_AnnounceStatus;
	time_t			m_AnnounceTime;
	std::string		m_AnnounceIP;

	CServerStatus(): m_MainStatus(Main_Off), m_LoginStatus(Account_Offline), 
		m_LoginTime(0), m_IPStatus(Unavail),
		m_DetectTime(0), m_NATTStatus(Unavail), m_HasNAT(false),
		m_AnnounceStatus(Announce_Fail), m_AnnounceTime(0)
	{
	}

	void Reset()
	{
		m_MainStatus		= Main_Off;
		m_LoginStatus		= Account_Offline;
		m_LoginTime			= 0;
		m_IPStatus			= Unavail;
		m_DetectTime		= 0;
		m_NATTStatus		= Unavail;
		m_HasNAT			= false;
		m_AnnounceStatus	= Announce_Fail;
		m_AnnounceTime		= 0;
	}
};

#endif